/*  BEGIN_FILE_HDR
******************************************Copyright(C)*****************************************
*
*                                       YKXH  Technology
*
***********************************File Info***************************************************
*   File Name       @: CANApp.h
************************************************************************************************
*   Project/Product @: Common
*   Title           @: CANApp.h 
*   Author          @: zhongliang.Yang 
************************************************************************************************
*   Description     @: 
*                     
************************************************************************************************
*   Limitations     @: None
*
************************************************************************************************
*
************************************************************************************************
*   Revision History:
* 
*   Version     Date          Initials           CR#         Descriptions
*   --------    -----------   ----------------   --------    -----------------------
*   1.0         2018/05/29    zhongliang.yang    N/A         Original 
*   1.1         xxxx/xx/xx    xxxxx              N/A         xxxxxxxx 
*     
************************************************************************************************
* END_FILE_HDR*/


#ifndef _CANAPP_H_
#define _CANAPP_H_

/*declaration range definition*/
#ifdef _CANAPP_C_ 
#define CANAPP_EXT 
#else 
#define CANAPP_EXT extern 
#endif

#include "../src/BSW/Comms/NM//YKBase/BaseComm.h"
#include "../src/BSW/Comms/NM//CommonHeader/Common.h"
#if(USE_UDS_MODULE == STD_ON)
#include "../src/BSW/Comms/NM//UDS/Dcm/Dcm.h"
#include "../src/BSW/Comms/NM//UDS/CanTp/CanTp.h"
#include "../src/BSW/Comms/NM//UDS/DTC_Collect/DTC_Collect.h"
#endif

#if(USE_CCP_MODULE == STD_ON)


#include "../src/AsComStack/CCP/Ccp.h"
#endif


#define    CAN_HANDLE_TX_DBUG              (0U)

#define    CAN_HANDLE_RX_DBUG              (0U)


#define    CAN_TX_CYCLE                    (10U)


/****can if start******/
/*****RX START*****/
typedef  struct
{
    union 
    {
        uint8  DataFld[8];     /* Data 0 .. 7                 */
        struct
        {
            uint8             RxDebugValue1   ;
            uint8             RxDebugValue2   ;  
            uint8             RxDebugValue3   ;
            uint8             RxDebugValue4   ;
            uint8             RxDebugValue5   ;
            uint8             RxDebugValue6   ;
            uint8             RxDebugValue7   ;
            uint8             RxDebugValue8   ;
        }Bits;
    }InputMsg;
    uint8  DLC;               /* Data length reg.            */
}t_RxMsgDebug;

CANAPP_EXT    t_RxMsgDebug                p_RxMsgDebug;
CANAPP_EXT    t_RxMsgDebug                p_RxMsgIGNSW;






#define    RxOsekSleepSig           p_RxMsgDebug.InputMsg.Bits.RxDebugValue1
#define    RxOsekSilentSig          p_RxMsgDebug.InputMsg.Bits.RxDebugValue2
#define    Rx28ServiceRxSig         p_RxMsgDebug.InputMsg.Bits.RxDebugValue3
#define    RxDtcRecordCtrl          p_RxMsgDebug.InputMsg.Bits.RxDebugValue4
#define    RxDtcMocycleActiveFlag   p_RxMsgDebug.InputMsg.Bits.RxDebugValue5
#define    RxDebugVal1              p_RxMsgDebug.InputMsg.Bits.RxDebugValue6
#define    RxDebugVal2   			p_RxMsgDebug.InputMsg.Bits.RxDebugValue7
#define    RxDebugVal3              p_RxMsgDebug.InputMsg.Bits.RxDebugValue8 

#define    RxDebugDlc    p_RxMsgDebug.DLC


#define    RxAutosarSleepSig    p_RxMsgIGNSW.InputMsg.Bits.RxDebugValue1
#define    RxAutosarRepeatSig   p_RxMsgIGNSW.InputMsg.Bits.RxDebugValue2
#define    RxIGNVal3            p_RxMsgIGNSW.InputMsg.Bits.RxDebugValue3
#define    RxIGNVal4   p_RxMsgIGNSW.InputMsg.Bits.RxDebugValue4
#define    RxIGNVal5   p_RxMsgIGNSW.InputMsg.Bits.RxDebugValue5
#define    RxIGNVal6   p_RxMsgIGNSW.InputMsg.Bits.RxDebugValue6
#define    RxIGNVal7   p_RxMsgIGNSW.InputMsg.Bits.RxDebugValue7
#define    RxIGNVal8   p_RxMsgIGNSW.InputMsg.Bits.RxDebugValue8
#define    RxIGNDlc    p_RxMsgIGNSW.DLC




/*****RX END*****/


                                        
                                             
                                       
/*****TX START*****/
typedef union
{
  uint8   DataFld[8];
   
  struct
  {
   uint8             TxDebugValue1   ;
   uint8             TxDebugValue2   ;  
   uint8             TxDebugValue3   ;
   uint8             TxDebugValue4   ;
   uint8             TxDebugValue5   ;
   uint8             TxDebugValue6   ;
   uint8             TxDebugValue7   ;
   uint8             TxDebugValue8   ;
  }Bits;
  
}t_TxMsgDebug;

CANAPP_EXT    t_TxMsgDebug         p_TxMsgDebug; 
 
#define    TxRunningCnt       p_TxMsgDebug.Bits.TxDebugValue1
#define    Tx28ServiceRxSig   p_TxMsgDebug.Bits.TxDebugValue2
#define    Tx2FCtrlFlag       p_TxMsgDebug.Bits.TxDebugValue3
#define    TxDtcOccurCnt      p_TxMsgDebug.Bits.TxDebugValue4
#define    TxDtcAgingCnt      p_TxMsgDebug.Bits.TxDebugValue5
#define    TxDebugVal6        p_TxMsgDebug.Bits.TxDebugValue6
#define    TxDebugVal7        p_TxMsgDebug.Bits.TxDebugValue7
#define    TxDebugVal8   	  p_TxMsgDebug.Bits.TxDebugValue8
   
   
/*****TX END*****/

/*for app rx & tx*/
CANAPP_EXT uint8 gCanRxAppFlag;
CANAPP_EXT uint8 gCanTxAppFlag;



CANAPP_EXT void  CanAppInit(void);
#if(STD_OFF == USE_COM_MODULE) 
CANAPP_EXT void  Com_RxIndication(PduIdType CanUserRxPduId, const PduInfoType* PduInfoPtr );
CANAPP_EXT void  Com_TxConfirmation(PduIdType CanUserTxPduId);
#endif
CANAPP_EXT void  CanWriteProc(void);
CANAPP_EXT void  CanReadProc(void);
CANAPP_EXT void  CanApp(void);
CANAPP_EXT void  SysSleepApp(void);
CANAPP_EXT void CANNMUserDataHandle(const UINT8 channel);                //yyr autosar debug

#if(USE_CCP_MODULE == STD_ON)
CANAPP_EXT void  CCP_TEST_INIT(void);

CANAPP_EXT void  CCP_TEST_FUN(void);
#endif

#endif
